import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { FormsModule,
  ReactiveFormsModule, FormBuilder,
  FormControl,
  FormGroup,
  Validators } from '@angular/forms';
import { HttpModule } from '@angular/http';
import {NgxEchartsModule} from 'ngx-echarts';
import { CommonModule,registerLocaleData } from '@angular/common';
import { NgZorroAntdModule, NZ_I18N, zh_CN} from 'ng-zorro-antd';
import en from '@angular/common/locales/en';  //英文
import zh from '@angular/common/locales/zh';   //中文
registerLocaleData(en);
registerLocaleData(zh);
import { LoginComponent } from './login/login.component';
import { HomeComponent } from './home/home.component';
import { AppRoutingModule } from './app-routing.module';
import {TranslateLoader, TranslateModule} from "@ngx-translate/core";
import {TranslateHttpLoader} from "@ngx-translate/http-loader";
import {HttpClient, HttpClientModule} from "@angular/common/http";
import { DeviceDebugAmComponent } from './home/device-debug-am/device-debug-am.component';
import { DeviceDebugRfComponent } from './home/device-debug-rf/device-debug-rf.component';
import { DeviceDebugCab07Component } from './home/device-debug-cab07/device-debug-cab07.component';
import {DeviceDebugDb112Component} from './home/device-debug-db112/device-debug-db112.component';
import { TestComponent } from './test/test.component';
import { ChangeTextDirective } from './test/directive/change-text.directive'
import {SqrtPipe} from './test/pipe/app.sqrt';
import { TtPipe } from './test/pipe/tt.pipe'
import {MyserviceService} from "./test/service/myservice.service"
export function HttpLoaderFactory(http: HttpClient) {
  return new TranslateHttpLoader(http, 'assets/i18n/', '.json');
}
@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    HomeComponent,
    DeviceDebugAmComponent,
    DeviceDebugRfComponent,
    DeviceDebugCab07Component,
    DeviceDebugDb112Component,
    TestComponent,
    ChangeTextDirective,
    SqrtPipe,
    TtPipe,
  ],
  providers   : [
    { provide: NZ_I18N, useValue: zh_CN},
    MyserviceService
  ],
  imports: [
    NgxEchartsModule,
    FormsModule,
    ReactiveFormsModule,
    BrowserModule,
    BrowserAnimationsModule,
    HttpClientModule,
    CommonModule,
    NgZorroAntdModule,
    AppRoutingModule,
    HttpModule,
    TranslateModule.forRoot({
      loader: {
          provide: TranslateLoader,
          useFactory: HttpLoaderFactory,
          deps: [HttpClient]
       }
   })
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}
